package com.okq.service.Impl;

import com.okq.dao.UserDao;
import com.okq.entity.User;
import com.okq.service.IUserService;
import com.okq.util.page.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 描述 : 用户业务接口实现
 * 作者 : zdl
 * 日期 : 2017/6/28 13:47
 */
@Transactional // 启用事务机制
@Service
public class UserServiceImpl implements IUserService {

    @Autowired
    private UserDao userDao;

    @Override
    public void saveUser(User user) {
        userDao.saveUser(user);
    }

    @Override
    public void deleteUser(User user) {
        userDao.deleteUser(user);
    }

    @Override
    public void updateUser(User user) {
        userDao.updateUser(user);
    }

    @Override
    public void saveOrUpdateUser(User user) {
        userDao.saveOrUpdateUser(user);
    }

    @Override
    public User getUserById(String id) {
        return userDao.getUserById(id);
    }

    @Override
    public List<User> listAllUser() {
        return userDao.listAllUser();
    }

    @Override
    public User getUserByLoginName(String loginName) {
        return userDao.getUserByLoginName(loginName);
    }

    @Override
    public List<User> listUserByGroupId(String groupId) {
        return userDao.listUserByGroupId(groupId);
    }

    @Override
    public List<User> listUserByRoleId(String roleId) {
        return userDao.listUserByRoleId(roleId);
    }

    @Override
    public Page<User> pageByUser(Page<User> page, User user, String groupIds) {
        return userDao.pageByUser(page, user, groupIds);
    }

    @Override
    public List<User> listUserByUserName(String userName) {
        return userDao.listUserByUserName(userName);
    }

    @Override
    public List<User> listUserByGroupIds(String groupIds) {
        return userDao.listUserByGroupIds(groupIds);
    }

    @Override
    public User getUserByPhone(String cellPhone) {
        return userDao.getUserByPhone(cellPhone);
    }


}
